import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.EtchedBorder;


public class TreePanel extends JPanel {

	static final int BROWSE_TREE = 1;
	static final int SEARCH_TREE = 2;
	private TreeStructure treeStructure;
	
	/**
	 * Create the panel
	 */
	public TreePanel(int type) {
		super();
		
		treeStructure = new TreeStructure(type);
		setLayout(new GridBagLayout());

		final JLabel northSpacer = new JLabel();
		northSpacer.setPreferredSize(new Dimension(0, 20));
		final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
		gridBagConstraints_1.gridx = 1;
		gridBagConstraints_1.gridy = 0;
		add(northSpacer, gridBagConstraints_1);

		final JLabel westSpacer = new JLabel();
		westSpacer.setPreferredSize(new Dimension(20, 20));
		final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
		gridBagConstraints_2.weightx = 0.02;
		gridBagConstraints_2.gridy = 1;
		gridBagConstraints_2.gridx = 0;
		add(westSpacer, gridBagConstraints_2);

		final JPanel panel = new JPanel();
		panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
		panel.setLayout(new GridBagLayout());
		final GridBagConstraints gridBagConstraints = new GridBagConstraints();
		gridBagConstraints.fill = GridBagConstraints.BOTH;
		gridBagConstraints.weighty = 0.9;
		gridBagConstraints.weightx = 0.9;
		gridBagConstraints.gridy = 1;
		gridBagConstraints.gridx = 1;
		add(panel, gridBagConstraints);

		final JScrollPane scrollPane = new JScrollPane();
		final GridBagConstraints gridBagConstraints_5 = new GridBagConstraints();
		gridBagConstraints_5.fill = GridBagConstraints.BOTH;
		gridBagConstraints_5.weighty = 1.0;
		gridBagConstraints_5.weightx = 1.0;
		gridBagConstraints_5.gridy = 0;
		gridBagConstraints_5.gridx = 0;
		panel.add(scrollPane, gridBagConstraints_5);

		scrollPane.setViewportView(treeStructure);

		final JLabel eastSpacer = new JLabel();
		eastSpacer.setPreferredSize(new Dimension(20, 0));
		final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();
		gridBagConstraints_3.weightx = 0.02;
		gridBagConstraints_3.gridy = 1;
		gridBagConstraints_3.gridx = 2;
		add(eastSpacer, gridBagConstraints_3);

		final JLabel southSpacer = new JLabel();
		southSpacer.setPreferredSize(new Dimension(0, 20));
		final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
		gridBagConstraints_4.gridy = 2;
		gridBagConstraints_4.gridx = 1;
		add(southSpacer, gridBagConstraints_4);
		//
	}

	public TreeStructure getTreeStructure() {
		return treeStructure;
	}

}
